package com.fengye.algorithms.leecode.dp;

/**
 * @Author fengye
 * @Date 2023/4/8 10:43
 **/
public class ClimbStairs70 {

    public int climbStairs(int n) {
        int[] list = new int[46];
        list[1] = 1;
        list[2] = 2;

        return dfs(n, list);
    }

    public int dfs(int n, int[] list) {
        if(list[n] != 0) {
            return list[n];
        }
        list[n] = dfs(n-1, list) + dfs(n-2, list);
        return list[n];
    }
}
